package com.ssm.subject.infra.basic.service.impl;

import com.alibaba.fastjson.JSON;
import com.ssm.subject.infra.basic.entity.SubjectBrief;
import com.ssm.subject.infra.basic.mapper.SubjectBriefDao;
import com.ssm.subject.infra.basic.service.SubjectBriefService;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 简答题(SubjectBrief)表服务实现类
 *
 * @author makejava
 * @since 2024-11-29 10:24:45
 */
@Service("subjectBriefService")
@Log4j2
public class SubjectBriefServiceImpl implements SubjectBriefService {
    @Resource
    private SubjectBriefDao subjectBriefDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public SubjectBrief queryById(Long id) {
        return this.subjectBriefDao.queryById(id);
    }

    /**
     * 新增数据
     *
     * @param subjectBrief 实例对象
     * @return 实例对象
     */
    @Override
    public void insert(SubjectBrief subjectBrief) {
        if(log.isInfoEnabled()) {
            log.info("SubjectBriefService.add.subjectBrief:{}", JSON.toJSONString(subjectBrief));
        }
        this.subjectBriefDao.insert(subjectBrief);
    }

    /**
     * 修改数据
     *
     * @param subjectBrief 实例对象
     * @return 实例对象
     */
    @Override
    public int update(SubjectBrief subjectBrief) {
        return this.subjectBriefDao.update(subjectBrief);
    }

    /**
     * 根据题目id查询
     * @param subjectBrief
     * @return
     */
    @Override
    public SubjectBrief query(SubjectBrief subjectBrief) {
        return this.subjectBriefDao.query(subjectBrief);
    }

}
